package com.O2suanfa;

import java.util.ArrayList;

public class Test02 {
    public static void main(String[] args) {
        String s = "abcabcbb";
        char[] sCharArray = s.toCharArray();

        int begin = 0;
        int index = 0;
        int end = 0;

        ArrayList<Character> res = new ArrayList<>();


        for(begin = index;begin < sCharArray.length;begin++){
            if(res.isEmpty() ){
                res.add(sCharArray[begin]);
            }
            if( !res.contains(sCharArray[begin])){
                res.add(sCharArray[begin]);
            }else{
                index ++;
                res.stream().forEach(System.out::print);
                System.out.println("\n");
//                System.out.println("res"+res.size());
                res.clear();
                res = new ArrayList<>();
                continue;
            }
        }


    }
}
